package folder.main.exp1.algorithms;

import java.util.Comparator;

import folder.model.network.Network;
import folder.model.network.NetworkPaths;
import folder.model.node.Node;

public class Random extends Algorithm1
{	
	// Algorithm
	
	public static Random random( Network networkPath, int numberNodesSpecial )
	{
		return new Random( networkPath, numberNodesSpecial );
	}
	
	public Random( Network networkPath, int numberNodesSpecial )
	{
		super( networkPath, numberNodesSpecial );
		
		this.comparator = new ComparatorRandom();
		
		this.runAlgorithm();
	}
	
	// Comparator
	
    private class ComparatorRandom implements Comparator< Node >
    {
    	@Override
    	public int compare( Node nodeX, Node nodeY )
    	{   
    		Double identifierRandomNodeX = nodeX.getIdentifierRandom();
    		Double identifierRandomNodeY = nodeY.getIdentifierRandom();
    		
    		return identifierRandomNodeX.compareTo( identifierRandomNodeY );
    	}
    }

}
